package dal;

import hist_data.DailyBar;
import hist_data.DailyPair;
import hist_data.MinuteBar;
import iblink.core.HistoricalData;
import iblink.core.Stock;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import packutil.FileUtil;

public class FileSystemDA implements IAppDataAccessor, IHistoricalDataAccessor {

	@Override
	public List<Stock> getUnprocessedStocks(Date d) {
		List<Stock> stocks = new ArrayList<Stock>();
		stocks.add(new Stock("GOOG", null, null, null, null, null));
		stocks.add(new Stock("MSFT", null, null, null, null, null));
		return stocks;
	}

	@Override
	public Date getLastProcessedDate(String process) {
		return new Date();
	}

	@Override
	public void recordProcessBegin(String processName, Date date) {
		System.out.println("recordProcessBegin(" + processName + ", " + date
				+ ")");
	}

	@Override
	public void recordProcessComplete(String processName) {
		System.out.println("recordProcessComplete(" + processName + ")");
	}

	@Override
	public void recordProcessError(String processName, Exception e) {
		System.out
				.println("recordProcessError(" + processName + ", " + e + ")");
		e.printStackTrace();
	}

	public void saveMinuteBars(Stock security, List<MinuteBar> dataPoints) {
		System.out.println("Saving hist data for " + security);
		FileUtil.writeToFile("tmp.txt", dataPoints.iterator());
	}

	@Override
	public List<Date> getNyseHolidays() {
		return new ArrayList<Date>();
	}

	@Override
	public void addUpdateStock(Stock stk) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public MinuteBar getLastBar(Stock stock, Date date) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void saveDailyBar(Stock stock, DailyBar dailyBar) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<Stock> getProcessedStocks(Date date) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void saveDailyPair(DailyPair dailyPair) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public DailyPair getDailyPair(Stock s1, Stock s2, Date d) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<MinuteBar> getMinuteBars(Stock stock, Date date) {
		// TODO Auto-generated method stub
		return null;
	}
}